package mya.mes.mdc.model.data;

import mya.mes.mdc.model.plc.PlcTagDef;
import mya.mes.mdc.model.plc.PlcTagType;

import javax.persistence.*;

/**
 * prefix: AI = 1, DI = 2, ST = 3 <br>
 * objectId = prefix+  tagIndex（4位）  + bitIndex（2位）
 */
@Entity
@Cacheable
@org.eclipse.persistence.annotations.Cache(size = 2000)
@Table(name = "MDC_DATA_TYPE", indexes = {
        @Index(name = "TAG_IDNEX", columnList = "MDC_TAG ASC"),
        @Index(name = "TAG_BIT_IDNEX", columnList = "MDC_TAG ASC,BIT_INDEX ASC"),
})
public class MdcDataType extends PlcTagDef {

    @Transient
    private final PlcTagType plcTagType = PlcTagType.DATA;

    /**
     * 需要图表展示
     */
    private Boolean chartShow = false;

    /**
     * 勾选菜单显示
     *
     * @return
     */
    private Boolean menuShow = true;

    /**
     * 车间
     */
    public String shop = "OVEN";

    /**
     * 区域
     */
    public String area = "LINE3";

    /**
     * 小区域
     */
    public String section = "LINE3";

    /**
     * 具体的一个点或是设备
     */
    public String point = "LINE3";

    public Boolean getChartShow() {
        return chartShow;
    }

    public void setChartShow(Boolean chartShow) {
        this.chartShow = chartShow;
    }

    public Boolean getMenuShow() {
        return menuShow;
    }

    public void setMenuShow(Boolean menuShow) {
        this.menuShow = menuShow;
    }

    @Override
    public String getShop() {
        return shop;
    }

    @Override
    public void setShop(String shop) {
        this.shop = shop;
    }

    @Override
    public String getArea() {
        return area;
    }

    @Override
    public void setArea(String area) {
        this.area = area;
    }

    @Override
    public String getSection() {
        return section;
    }

    @Override
    public void setSection(String section) {
        this.section = section;
    }

    @Override
    public String getPoint() {
        return point;
    }

    @Override
    public void setPoint(String point) {
        this.point = point;
    }

    @Transient
    @Override
    public PlcTagType getPlcTagType() {
        return plcTagType;
    }
}
